home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Your Choice 3
/
Your Choice Software Collection 3.iso
/
os2
/
etelr21
/
etdir.vrm
< prev
next >
Wrap
Text File
|
1994-09-16
|
9KB
|
355 lines
/* Custom mainline for macro */
call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
call VRLoadFuncs
_VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
if( _VREVersion < 2.10 )then do
call VRMessage "", "This program requires VX-REXX version 2.1 to run.", "Error!"
return 32000
end
signal on SYNTAX name _VRESyntax
signal _VREMain
_VRESyntax:
parse source . . _VRESourceSpec
call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!"
call VRFini
exit 32000
_VREMain:
/*:VRX Main
*/
/* Main
*/
Main:
/* Process the arguments.
Get the parent window.
*/
parse source . calledAs .
parent = ""
argCount = arg()
argOff = 0
if( calledAs \= "COMMAND" )then do
if argCount >= 1 then do
parent = arg(1)
argCount = argCount - 1
argOff = 1
end
end
InitArgs.0 = argCount
if( argCount > 0 )then do i = 1 to argCount
InitArgs.i = arg( i + argOff )
end
drop calledAs argCount argOff
/* Load the windows
*/
call VRInit
parse source . . spec
_VREPrimaryWindowPath = ,
VRParseFileName( spec, "dpn" ) || ".VRW"
_VREPrimaryWindow = ,
VRLoad( parent, _VREPrimaryWindowPath )
drop parent spec
if( _VREPrimaryWindow == "" )then do
call VRMessage "", "Cannot load window:" VRError(), ,
"Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
/* Process events
*/
call Init
signal on halt
do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
_VREEvent = VREvent()
interpret _VREEvent
end
_VREHalt:
_VREReturnValue = Fini()
call VRDestroy _VREPrimaryWindow
_VRELeaveMain:
call VRFini
exit _VREReturnValue
VRLoadSecondary: procedure
name = arg( 1 )
window = VRLoad( VRWindow(), VRWindowPath(), name )
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
return window
/*:VRX CreateDir
*/
CreateDir:
Buttons.1 = "~Create"
Buttons.2 = "~Cancel"
Buttons.0 = 2
id = VRMessage( VRWindow(), "Account directory '"||NewDir||"' does not exist. Create it?", "Create Directory", "Query", "Buttons.", 1, 2 )
drop buttons.
if id = 2 then
NewDir = WorkDir
if( \VRMkDir( NewDir ) )then do
call VRMessage '', VRError(), 'Error'
NewDir = WorkDir
end
return
/*:VRX Fini
*/
Fini:
window = VRWindow()
call VRSet window, "Visible", 0
drop window
return 0
/*:VRX Halt
*/
Halt:
signal _VREHalt
return
/*:VRX Init
*/
Init:
call VRMethod 'Application', 'GetVar', 'args.'
INI = args.1
et = args.2
WorkDir = args.3
if et = 'ET' then do
call VRSet 'EFAcctDir', 'Enabled', 1
call VRSet 'EFIconDir', 'Enabled', 1
end
if et = 'REPORT' then
call VRSet 'EFReptDir', 'Enabled', 1
if et = 'BUDGET' then
call VRSet 'EFBudgDir', 'Enabled', 1
window = VRWindow()
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
drop window
return
/*:VRX MoveAccount
*/
MoveAccount:
rc = 'ERROR'
call VRMethod 'Application', 'PutVar', 'rc'
s = VRDir( OldAcct'\*.clr', 'N' )
count = 1
files.0 = 0
do while s <> ''
files.count = OldAcct'\'s
files.0 = count
count = count + 1
s = VRDir( , 'N' )
end
if files.0 = 0 then do
call VRMessage "", "Could not locate account files in directory: "OldAcct"\. ", "Information"
return
end; else do
if( \VRCopyFile( OldAcct'\*.clr', AcctDir'\*.clr' ) )then do
call VRMessage "", VRError(), "Error"
return
end; else
call VRDeleteFile OldAcct'\*.clr'
if( \VRCopyFile( OldAcct"\*.ldg", AcctDir"\*.ldg" ) )then do
call VRMessage "", VRError(), "Error"
return
end; else
call VRDeleteFile OldAcct'\*.ldg'
if( \VRCopyFile( OldAcct"\*.dat", AcctDir"\*.dat" ) )then do
call VRMessage "", VRError(), "Error"
return
end; else
call VRDeleteFile OldAcct'\*.dat'
end
rc = 'OK'
call VRMethod 'Application', 'PutVar', 'rc'
return
/*:VRX MoveBudget
*/
MoveBudget:
s = VRDir( OldBudg'\*.bgt', 'N' )
count = 1
files.0 = 0
do while s <> ''
files.count = OldBudg'\'s
files.0 = count
count = count + 1
s = VRDir( , 'N' )
end
if files.0 = 0 then do
call VRMessage "", "Could not locate budget files in directory: "OldBudg"\. ", "Information"
return
end; else do
if( \VRCopyFile( OldBudg'\*.bgt', BudgDir'\*.bgt' ) )then do
call VRMessage '', VRError(), 'Error'
return
end; else
call VRDeleteFile OldBudg'\*.bgt'
end
return
/*:VRX MoveIcon
*/
MoveIcon:
s = VRDir( OldIcon'\*.ico', 'N' )
count = 1
files.0 = 0
do while s <> ''
files.count = OldIcon'\'s
files.0 = count
count = count + 1
s = VRDir( , 'N' )
end
if files.0 = 0 then do
call VRMessage "", "Could not locate icon files in directory: "OldIcon"\. ", "Information"
return
end; else do
if( \VRCopyFile( OldIcon'\*.ico', IconDir'\*.ico' ) )then do
call VRMessage '', VRError(), 'Error'
return
end; else
call VRDeleteFile OldIcon'\*.ico'
end
return
/*:VRX MoveReport
*/
MoveReport:
s = VRDir( OldRept'\*.rpt', 'N' )
count = 1
files.0 = 0
do while s <> ''
files.count = OldRept'\'s
files.0 = count
count = count + 1
s = VRDir( , 'N' )
end
if files.0 = 0 then do
call VRMessage "", "Could not locate report files in directory: "OldRept"\. ", "Information"
return
end; else do
if( \VRCopyFile( OldRept'\*.rpt', ReptDir'\*.rpt' ) )then do
call VRMessage '', VRError(), 'Error'
return
end; else
call VRDeleteFile OldRept'\*.rpt'
end
return
/*:VRX PBSWDirCancel_Click
*/
PBSWDirCancel_Click:
dir.0 = 0
call VRMethod 'Application', 'PutVar', 'dir.'
call Quit
return
/*:VRX PBSWDirSave_Click
*/
PBSWDirSave_Click:
AcctDir = Strip( VRGet( 'EFAcctDir', 'Value' ), 'T', '\' )
if( \VRIsDir( AcctDir ) )then do
NewDir = AcctDir
call CreateDir
AcctDir = NewDir
end
BudgDir = Strip( VRGet( 'EFBudgDir', 'Value' ), 'T', '\' )
if( \VRIsDir( BudgDir ) )then do
NewDir = BudgDir
call CreateDir
BudgDir = NewDir
end
IconDir = Strip( VRGet( 'EFIconDir', 'Value' ), 'T', '\' )
if( \VRIsDir( IconDir ) )then do
NewDir = IconDir
call CreateDir
IconDir = NewDir
end
ReptDir = Strip( VRGet( 'EFReptDir', 'Value' ), 'T', '\' )
if( \VRIsDir( ReptDir ) )then do
NewDir = ReptDir
call CreateDir
ReptDir = NewDir
end
if BudgDir <> OldBudg then do
call VRSetIni 'Main', 'BudgDir', BudgDir, INI
call MoveBudget
end
if IconDir <> OldIcon then do
call VRSetIni 'Main', 'IconDir', IconDir, INI
call MoveIcon
end
if ReptDir <> OldRept then do
call VRSetIni 'Main', 'ReptDir', ReptDir, INI
call MoveReport
end
if AcctDir <> OldAcct then do
call VRSetIni 'Main', 'AcctDir', AcctDir, INI
call MoveAccount
end
dir.1 = AcctDir
dir.2 = BudgDir
dir.3 = IconDir
dir.4 = ReptDir
dir.0 = 4
call VRMethod 'Application', 'PutVar', 'dir.'
call Quit
return
/*:VRX Quit
*/
Quit:
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
return
/*:VRX Window1_Close
*/
Window1_Close:
call Quit
return
/*:VRX Window1_Create
*/
Window1_Create:
WorkDir = VRGet( 'Application', 'WorkingDirectory' )
AcctDir = VRGetIni( 'Main', 'AcctDir', INI, 'NoClose' )
BudgDir = VRGetIni( 'Main', 'BudgDir', INI, 'NoClose' )
IconDir = VRGetIni( 'Main', 'IconDir', INI, 'NoClose' )
ReptDir = VRGetIni( 'Main', 'ReptDir', INI )
if AcctDir = '' then
acctDir = WorkDir
if BudgDir = '' then
budgDir = WorkDir
if IconDir = '' then
IconDir = WorkDir||"\Icons"
if ReptDir = '' then
ReptDir = WorkDir
call VRSet 'EFAcctDir', 'Value', AcctDir
call VRSet 'EFBudgDir', 'Value', BudgDir
call VRSet 'EFIconDir', 'Value', IconDir
call VRSet 'EFReptDir', 'Value', ReptDir
OldAcct = AcctDir
OldBudg = BudgDir
OldIcon = IconDir
OldRept = ReptDir
return
/*:VRX Window1_Help
*/
Window1_Help:
address cmd 'view e-teller Directories...'
return